#include <bits/stdc++.h>
using namespace std;

int n, a[100002], cnt[100002], num[100002], chan[100002];

int main() {
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    scanf("%d", &n);
    int p = 0;
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        cnt[a[i]]++;
    }
    for (int i = 1; i <= 100002; i++) {
        if (cnt[i]) {
            num[++p] = cnt[i];
        }
    }
    for (int i = 1; i <= p; i++) {
        chan[i] = num[i] + chan[i - 1];
    }
    if (p == 1) {
        printf("%d", n);
    }
    for (int i = 1; i < p; i++) {
        chan[p] -= chan[i] - chan[i - 1];
        if (chan[p] <= num[i]) {
            int ans = num[i] - chan[p];
            for (int j = i + 1; j <= p; j++) {
                ans += num[j];
            }
            printf("%d", ans);
            return 0;
        }
    }
    return 0;
}
